package com.netted.myapplication;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import java.util.List;
import java.util.Map;
public class TalkLeftAdapter   extends BaseAdapter{

    private List<Map<String, String>> contents;
    private Context context;

    public TalkLeftAdapter(List<Map<String, String>> paramList, Context paramContext)
    {
        this.contents = paramList;
        this.context = paramContext;
    }

    public int getCount()
    {
        return this.contents.size();
    }

    public Object getItem(int paramInt)
    {
        return this.contents.get(paramInt);
    }

    public long getItemId(int paramInt)
    {
        return paramInt;
    }

    public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
    {
        Map localMap = (Map)this.contents.get(paramInt);
        ViewHolder localViewHolder;
        if (paramView == null) {
            if (((String)localMap.get("userId")).equals(localMap.get("sendUserId")))
            {
                paramView = LayoutInflater.from(this.context).inflate(R.layout.talk_right, null);
                localViewHolder = new ViewHolder();
                localViewHolder.msgTV = ((TextView)paramView.findViewById(R.id.right_content_tv));
                localViewHolder.nameTV = ((TextView)paramView.findViewById(R.id.right_user_name_tv));
                paramView.setTag(localViewHolder);
                label103:
                if (!((String)localMap.get("userId")).equals(localMap.get("sendUserId"))) {
//                    break;
                }
                localViewHolder.nameTV.setText("：你");
            }
        }else{
            paramView = LayoutInflater.from(this.context).inflate(R.layout.talk_left, null);
            localViewHolder = new ViewHolder();
            localViewHolder.msgTV = ((TextView)paramView.findViewById(R.id.left_content_tv));
            localViewHolder.nameTV = ((TextView)paramView.findViewById(R.id.left_user_name_tv));
            paramView.setTag(localViewHolder);
            label103:
            if (!((String)localMap.get("userId")).equals(localMap.get("sendUserId"))) {
//                    break;
            }
            localViewHolder.nameTV.setText((String)((Map)this.contents.get(paramInt)).get("userName") + "：");
        }

        return paramView;
    }

    static class ViewHolder
    {
        TextView msgTV;
        TextView nameTV;
    }
}
